﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Play 的摘要说明
/// </summary>
public class Play
{
    public Play()
    {
        //
        // TODO: 在此处添加构造函数逻辑
        //
    }
    public static string MediaPlayer(string width, string height, string link)
    {
        string str = "";
        try
        {
            str += "<object id='player' height='" + height + "' width='" + width + "' classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6' codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701standby=Loading Microsoft? Windows Media? Player components... type=application/x-oleobject>";
            str += "<param NAME='AutoStart' VALUE='0'>";
            //str += "<!--是否自动播放-->"; 
            str += "<param NAME='Balance' VALUE='0'>";
            //str += "<!--调整左右声道平衡,同上面旧播放器代码-->"; 
            str += "<param name='enabled' value='1'>";
            //str += "<!--播放器是否可人为控制-->"; 
            str += "<param NAME='EnableContextMenu' VALUE='-1'>";
            //str += "<!--是否启用上下文菜单-->"; 
            str += "<param NAME='url' value='" + link + "'>";
            //str += "<!--播放的文件地址-->"; 
            str += "<param NAME='PlayCount' VALUE='1'>";
            //str += "<!--播放次数控制,为整数-->"; 
            str += "<param name='rate' value='1'>";
            //str += "<!--播放速率控制,1为正常,允许小数,1.0-2.0-->"; 
            str += "<param name='currentPosition' value='0'>";
            //str += "<!--控件设置:当前位置-->"; 
            str += "<param name='currentMarker' value='0'>";
            //str += "<!--控件设置:当前标记-->"; 
            str += "<param name='defaultFrame' value=''>";
            //str += "<!--显示默认框架-->"; 
            str += "<param name='invokeURLs' value='0'>";
            //str += "<!--脚本命令设置:是否调用URL-->"; 
            str += "<param name='baseURL' value=''>";
            //str += "<!--脚本命令设置:被调用的URL-->"; 
            str += "<param name='stretchToFit' value='0'>";
            //str += "<!--是否按比例伸展-->"; 
            str += "<param name='volume' value='50'>";
            //str += "<!--默认声音大小0%-100%,50则为50%-->"; 
            str += "<param name='mute' value='0'>";
            //str += "<!--是否静音-->"; 
            str += "<param name='uiMode' value='Full'>";
            //str += "<!--播放器显示模式:Full显示全部;mini最简化;None不显示播放控制,只显示视频窗口;invisible全部不显示-->"; 
            str += "<param name='windowlessVideo' value='0'>";
            //str += "<!--如果是0可以允许全屏,否则只能在窗口中查看-->"; 
            str += "<param name='fullScreen' value='0'>";
            //str += "<!--开始播放是否自动全屏-->"; 
            str += "<param name='enableErrorDialogs' value='-1'>";
            //str += "<!--是否启用错误提示报告-->"; 
            str += "<param name='SAMIStyle' value>";
            //str += "<!--SAMI样式-->"; 
            str += "<param name='SAMILang' value>";
            //str += "<!--SAMI语言-->"; 
            str += "<param name='SAMIFilename' value>";
            //str += "<!--字幕ID-->"; 
            str += "</object>";

        }
        catch (Exception ex)
        {
            return ex.Message.ToString();
        }
        return str;
    } 
      public static string TVCPlayer(string width, string height, string link)
      {
        string str = "";
        try
        {
            str += " <object><PARAM NAME='PLAY' VALUE='false'><param name='allowScriptAccess' value='always'></param><param name='wmode' value='transparent'></param><param name='movie' value='" + link + "'></param><embed src='" + link + "' width='" + width + "' height='" + height + "' allowScriptAccess='always' wmode='transparent'  type='application/x-shockwave-flash' /></object>";


         }
        catch (Exception ex)
        {
            return ex.Message.ToString();
        }
        return str;

      }
    public static string MediaPlayer1(int width, int height, string link)
    {
        string str = "";
        try
        {
            str += "<script type='text/javascript'>";


            str += "var s1 = new SWFObject('../../uploadFile/player.swf','ply'," + width + "," + height + ",'9','#FFFFFF');";

            str += "s1.addParam('allowfullscreen','true');";
            str += "s1.addParam('allowscriptaccess','always');";

            str += "s1.addParam('flashvars','file=" + link + "&image=preview.jpg');";
            str += "s1.write('container');";
            str += "</script>";


        }
        catch (Exception ex)
        {
            return ex.Message.ToString();
        }
        return str;
    }
    public static string MediaPlayer2(int width, int height, string link,string panal)
    {
        string str = "";
        try
        {
            str += "<script type='text/javascript'>";


            str += "var s1 = new SWFObject('uploadFile/player.swf','ply'," + width + "," + height + ",'9','#FFFFFF');";

            str += "s1.addParam('allowfullscreen','true');";
            str += "s1.addParam('allowscriptaccess','always');";

            str += "s1.addParam('flashvars','file=" + link + "&image=preview.jpg');";
            str += "s1.write('"+panal+"');";
            str += "</script>";


        }
        catch (Exception ex)
        {
            return ex.Message.ToString();
        }
        return str;
    }
    public static string FlexPaperViewer(int width, int height,string filepath)
    {
        string str="";
        try
        {
            if (width == 0&&height==0)
            {
                str += "<a id='viewerPlaceHolder' style='width:100%;height:100%;display:block'></a>";
            }
            else
            {
                str += "<a id='viewerPlaceHolder' style='width:" + width + "px;height:" + height + "px;display:block'></a>";
            }
            str += "<script type='text/javascript'>";
            str += "var fp = new FlexPaperViewer('../../FlexPaper/FlexPaperViewer',";
            str += " 'viewerPlaceHolder', { config: {";
            str += "SwfFile: '"+filepath+"',";
            str += "Scale: 0.8,";
            str += "ZoomTransition: 'easeOut',";
            str += "ZoomTime: 0.5,";
            str += "ZoomInterval: 0.2,";
            str += "FitPageOnLoad: false,";
            str += "FitWidthOnLoad: false,";
            str += "PrintEnabled: false,";
            str += "PrintToolsVisible: false,";
            str += "FullScreenAsMaxWindow: false,";
            str += "ProgressiveLoading: false,";
            str += "MinZoomSize: 0.2,";
            str += "MaxZoomSize: 5,";
            str += "SearchMatchAll: false,";
            str += "InitViewMode: 'Portrait',";
            str += "ViewModeToolsVisible: true,";
            str += "ZoomToolsVisible: true,";
            str += "NavToolsVisible: true,";
            str += "CursorToolsVisible: true,";
            str += "SearchToolsVisible: true,";
            str += "localeChain: 'zh_CN'";
            str += "}";
            str += "});";
            str += "</script> ";
        }
        catch (Exception ex)
        {
            return ex.Message.ToString();
        }
        return str;
    }

    public static string PlayBackGroudMusic(string filepath)
    {
        string str = "";
        try
        {
            str += "<embed src='"+filepath+"' width='0' height='0' type='audio/mpeg' loop='true' autostart='trun'>";
        }
        catch (Exception ex)
        {
            return ex.Message.ToString();
        }
        return str;
    }
}
